package com.enation.app.web.core.action.backend;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.enation.app.web.core.service.ISpiteVisitorManager;
import com.enation.framework.action.GridController;
import com.enation.framework.action.GridJsonResult;
import com.enation.framework.util.JsonResultUtil;

/**
 * 
 * @function 后台恶意访问控制层
 * @author 闯哥
 * @time 2016年12月11日 下午2:03:52
 */
@Controller
@RequestMapping("/core/admin/spite")
public class SpiteVisitorController extends GridController {

	@Autowired
	private ISpiteVisitorManager spiteVisitorManager;

	@RequestMapping("/spite-list")
	public ModelAndView spiteList() {

		ModelAndView view = new ModelAndView();
		List<String> pageNames = this.spiteVisitorManager.findPageName();
		view.addObject("pageNames", pageNames);
		view.setViewName("/core/admin/spite/spite_list");
		return view;
	}

	@ResponseBody
	@RequestMapping("/spite-list-json")
	public GridJsonResult spiteListJson(String start_time, String end_time,
			String student_number, String real_name, String pageName) {

		Map<String, Object> result = new HashMap<String, Object>();
		result.put("start_time", start_time);
		result.put("end_time", end_time);
		result.put("student_number", student_number);
		result.put("real_name", real_name);
		result.put("pageName", pageName);
		this.webpage = this.spiteVisitorManager.findList(result,
				this.getPage(), this.getPageSize());
		return JsonResultUtil.getGridJson(webpage);
	}

}
